home *** CD-ROM | disk | FTP | other *** search
/ El Mac 9 / El Mac 9.iso / Shareware / Demos / Igor Demo Pro / 1 PutContentsIn Igor Pro Folder / WaveMetrics Procedures / Waves / Wave Lists < prev    next >
Encoding:
Text File  |  1996-01-29  |  2.0 KB  |  65 lines  |  [TEXT/IGR0]

  1. | NOTE:
  2. |    As of Igor Pro 3.0, this function is no longer needed and should not be used in new programming.
  3. |    It will not work if the graph contains waves from data folders other than the current data folder.
  4. |    Igor Pro 3.0 added the built-in TraceNameList function. Use TraceNameList to get a list of
  5. |    the traces in the graph. Then use TraceNameToWaveRef to get a wave reference for a particular
  6. |    trace. If necessary, use XWaveRefFromTrace to get the wave supplying the x in an XY pair.
  7.  
  8. | GraphWaveList(graphNameStr, matchStr, xOnly, yOnly, separatorStr)
  9. |    Returns a string containing a list of waves in the specified graph which fit
  10. |    certain criteria. Use this when you want only x waves or only y waves.
  11. |    If you want all waves, you can use the built-in WaveList function instead.
  12. |        graphNameStr can be the name of a graph or "" for the top graph
  13. |        matchStr is "*" to match any wave or some pattern to match only selected waves
  14. |        pass 1 for xOnly if you want only waves furnishing the x part of an XY pair
  15. |        pass 1 for yOnly if you want only waves furnishing the y part of an XY pair
  16. |        separatorStr is normally ";" or ","
  17. Function/S GraphWaveList(graphNameStr, matchStr, xOnly, yOnly, separatorStr)
  18.     String graphNameStr
  19.     String matchStr
  20.     Variable xOnly, yOnly
  21.     String separatorStr
  22.     
  23.     String list1, list2, w
  24.     Variable i
  25.     Variable waveTypeCode
  26.     
  27.     if (strlen(graphNameStr) == 0)
  28.         graphNameStr = WinName(0, 1)
  29.     endif
  30.     if (WinType(graphNameStr) != 1)
  31.         return ""                | bad graph name
  32.     endif
  33.     
  34.     | Apply matchStr and graphNameStr criteria
  35.     list1 = WaveList(matchStr, separatorStr, "WIN:" + graphNameStr)
  36.     
  37.     | Figure out which type of waves we want
  38.     waveTypeCode = 0
  39.     if (yOnly)
  40.         waveTypeCode = 1
  41.     endif
  42.     if (xOnly)
  43.         waveTypeCode = 2
  44.     endif
  45.     if (waveTypeCode == 0)
  46.         list2 = list1
  47.     else
  48.         | Now apply the xOnly or yOnly criterion
  49.         list2 = ""
  50.         i = 0
  51.         do
  52.             w = WaveName(graphNameStr, i , waveTypeCode)
  53.             if (strlen(w) == 0)
  54.                 break                            | no more waves
  55.             endif
  56.             if (strsearch(list1, w, 0) >= 0)
  57.                 list2 += w + separatorStr
  58.             endif
  59.             i += 1
  60.         while (1)
  61.     endif
  62.     
  63.     return list2
  64. End
  65.